home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / linuxcon.000 / linuxcon / linuxconf-1.6 / uucp / uucp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-26  |  1.6 KB  |  76 lines

  1. #pragma implementation
  2. #include "uucp.h"
  3. #include "../misc/misc.h"
  4. #include "uucp.m"
  5. #include "internal.h"
  6.  
  7. extern UUCP_HELP_FILE help_uucp;
  8.  
  9. /*
  10.     Main menu of uucp management
  11. */
  12. void uucp_edit ()
  13. {
  14.     int choice=0;
  15.     while (1){
  16.         static const char *systems = MSG_U(M_SYSTEMS,"Systems");
  17.         static const char *devices = MSG_U(M_HOSTS,"Devices and modems");
  18.         static const char *menuopt[]={
  19.             MSG_U(M_CONFIG,"Configure"),        systems,
  20.             " ",        devices,
  21.             NULL
  22.         };
  23.         MENU_STATUS code = xconf_menu (
  24.             MSG_U(T_UUCP,"UUCP configurator")
  25.             ,MSG_U(I_UUCP,"This package allows you to configure from\n"
  26.              "scratch a UUCP network using modem\n"
  27.              "and serial devices")
  28.             ,help_uucp
  29.             ,menuopt,choice);
  30.         if (code == MENU_QUIT || code == MENU_ESCAPE){
  31.             break;
  32.         }else{
  33.             const char *key = menuopt[choice*2+1];
  34.             if (key == systems){
  35.                 system_edit();
  36.             }else if (key == devices){
  37.                 devices_edit();
  38.             }
  39.         }
  40.     }
  41. }
  42.  
  43. static void uucp_usage ()
  44. {
  45.     xconf_error ("%s\n"
  46.         "uucpconf --connect site\n"
  47.         "\n"
  48.         "%s\n"
  49.         ,MSG_U(E_NETCONF,"uucpconf: Invalid arguments\n")
  50.         ,MSG_U(E_NETCONFDEF,"uucpconf without argument start the interactive mode\n")
  51.         );
  52. }
  53. int uucp_main (int argc, char *argv[])
  54. {
  55.     int ret = -1;
  56.     if (argc == 1){
  57.         uucp_edit();
  58.         ret = 0;
  59.     }else if (argc == 3){
  60.         char *arg1 = argv[1];
  61.         if (strcmp(arg1,"--connect")==0){
  62.             /* #Specification: uucpconf / option / --connect
  63.                 uucpconf --connect "system" establish a connexion (forced)
  64.                 to a uucp site.
  65.             */
  66.             xconf_notice (MSG_U(E_NOTDONE,"Not done yet, sorry!"));
  67.         }else{
  68.             uucp_usage();
  69.         }
  70.     }else{
  71.         uucp_usage();
  72.     }
  73.     return ret;
  74. }
  75.  
  76.